package com.spring.demo2.eg1;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author vhans
 */
@Configuration
public class ConfigBean {

    @Bean
    public ServiceA serviceA() {
        System.out.println("调用serviceA()方法");
        return new ServiceA();
    }

    @Bean
    public ServiceB serviceB1() {
        System.out.println("调用serviceB1()方法");
        return new ServiceB(this.serviceA());
    }

    @Bean
    public ServiceB serviceB2() {
        System.out.println("调用serviceB2()方法");
        return new ServiceB(this.serviceA());
    }
}
